// TestNtripC.cpp : 定义控制台应用程序的入口点。
//
#include "ntripdeal.h"
#include <stdio.h>  
#include <windows.h>  
#include <conio.h> 

UINT cnt = 0;
NtripDeal *ddd;
//定时事件  
void CALLBACK TimeProc(HWND hwnd, UINT message, UINT_PTR idTimer, DWORD dwTime)
{
	cnt++;
	printf("thread count = %d\n", cnt);
	ddd->timeTick();

	if (cnt == 3) 
	{
		ddd->connectNtrip("", 8002, NTRIP_DEFAULT_NODE, "", "");
	}
	if (cnt == 8)
	{
		//ddd->disconnectNtrip();
	}
	if (cnt == 12) 
	{
		ddd->connectNtrip("", 8002, "RTCM32_GGB", "", "");
	}
	if (cnt == 210)
	{
		ddd->disconnectNtrip();
	}
}

void CALLBACK NtripMsgCallTest(int code,const std::string &msg)
{
	printf(msg.c_str());
}

//主函数  
int main()
{

	ddd = new NtripDeal();
	ddd->init();
	ddd->callBack = NtripMsgCallTest;
	SetTimer(0, 0, 1000, &TimeProc);	
	
	MSG   msg;
	while (GetMessage(&msg, NULL, 0, 0))
	{
		if (msg.message == WM_TIMER)
		{
			DispatchMessage(&msg);
		}
	}
	//得到键盘输入后再退出  
	getch();
	return 0;
}


